﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using SystemCenterSoa.DtoModel.Common;
using SystemCenterSoa.DtoModel.SystemManager.MyModelDto;
using SystemCenterSoa.PoModel.SystemManager.MyModelPo;
using SystemCenterSoa.Service.SystemManager;

namespace SystemCenterSoa.ApiProject.Area.SystemManager
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class AttendanceController : SystemManagerBaseController
    {
        private AttendanceService _AttendanceService;
        public AttendanceController(AttendanceService AttendanceService)
        {
            _AttendanceService = AttendanceService;
        }

        /// <summary>
        /// 考勤月汇总—显示
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<MonthSummaryPo>> MonthSummaryPoIndex(string name)
        {
            try
            {
                var data = _AttendanceService.MonthSummaryPoIndex(name);
                return MyOk(data);
            }
            catch (Exception ex)
            {
                return MyError<List<MonthSummaryPo>>(ex);
            }
        }
        /// <summary>
        /// 考勤月专业组分析
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<ProfessionalPo>> ProfessionalPoIndex()
        {
            try
            {
                var data = _AttendanceService.ProfessionalPoIndex();
                return MyOk(data);
            }
            catch (Exception ex)
            {
                return MyError<List<ProfessionalPo>>(ex);
            }
        }
        /// <summary>
        /// 部门加班补助显示
        /// </summary>
        /// <param name="nian"></param>
        /// <param name="yue"></param>
        /// <returns></returns>
       [HttpGet]
        public ResultModel<List<ShowSubsidyDto>> showSubsidy()
        {
            try
            {
                var data = _AttendanceService.showSubsidy();
                return MyOk(data);
            }
            catch (Exception ex)
            {
                return MyError<List<ShowSubsidyDto>>(ex);
            }
        }
        /// <summary>
        /// 部门经理加班补助显示
        /// </summary>
        /// <param name="nian"></param>
        /// <param name="yue"></param>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<ShowSubsidyDto>> showJingliSubsidy()
        {
            try
            {
                var data = _AttendanceService.showJingliSubsidy();
                return MyOk(data);
            }
            catch (Exception ex)
            {
                return MyError<List<ShowSubsidyDto>>(ex);
            }
        }
    }
}
